<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>拖动</title>
	<style>
		.droptarget {
			float: left;
			width: 100px;
			height: 35px;
			margin: 15px;
			padding: 10px;
			border: 1px solid #aaaaaa;
		}
	</style>
</head>
<body>
<p>在两个矩形框中来回拖动 p 元素:</p>
<div class="droptarget">
	<p draggable="true" id="dragtarget">拖动我!</p>
</div>
<div class="droptarget"></div>
<script>

	/* 拖动效果 */
	document.addEventListener('dragstart',function (e) {
		e.dataTransfer.setData('Text',e.target.id);
	});


</script>
</body>
</html>
